home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #5 / Amiga Plus CD - 2000 - No. 5.iso / Tools / Dev / GameboyDev / GBDK / examples / filltest.c < prev    next >
Encoding:
C/C++ Source or Header  |  1999-03-29  |  1.1 KB  |  49 lines

  1. /* Sample Program to demonstrate the drawing functions in GBDK */
  2. /* Jon Fuge jonny@q-continuum.demon.co.uk */
  3.  
  4. #include <gb.h>
  5. #include <drawing.h>
  6.  
  7. void main()
  8. {
  9.     UBYTE  a,b,c,d,e;
  10.     c=0;
  11.     /* Draw many characters on the screen with different fg and bg colours */
  12.     for (a=0; a<=15; a++) {
  13.     for (b=0; b<=15; b++) {
  14.         gotogxy(b,a);
  15.         d=a/4;
  16.         e=b/4;
  17.         if (d==e) {
  18.         d=3-e;
  19.         }
  20.         color(d,e,SOLID);
  21.         gprintf("%c",c++);
  22.     } 
  23.     }
  24.  
  25.     /* Draw two circles, a line, and two boxes in different drawing modes */
  26.     color(LTGREY,WHITE,SOLID);
  27.     circle(140,20,15,M_FILL);
  28.     color(BLACK,WHITE,SOLID);
  29.     circle(140,20,10,M_NOFILL);
  30.     color(DKGREY,WHITE,XOR);
  31.     circle(120,40,30,M_FILL);
  32.     line(0,0,159,143);
  33.     color(BLACK,LTGREY,SOLID);
  34.     box(0,130,40,143,M_NOFILL);
  35.     box(50,130,90,143,M_FILL);
  36.  
  37.     /* Scroll the screen using the hardest method imaginable :) */
  38.     for (c=0; c<=143; c++) {
  39.     for (b=0; b<=142; b++) {
  40.         for (a=0; a<=159; a++) {
  41.         color(getpix(a,b+1),WHITE,SOLID);
  42.         plot_point(a,b);
  43.         }
  44.         color(WHITE,WHITE,SOLID);
  45.     }
  46.     line(0,143,159,143);
  47.     }
  48. }
  49.